$(function () {
    obj.init();
});
var obj = new function () {
    'use strict';
    return {
        form:null,
        id:null,
        init:function () {
            this.id = xhTool.getQuery('id');
            this.form = new xhForm($('#xh_form'));
            this.form.parse();

            this.listener();
        },
        listener:function () {
            var $this = this;

            $('#bt_modal_confirm', parent.document).click(function () {
                $this.funObj().checkAction(1);
            });

            $('#unPass',parent.document).click(function () {
                $this.funObj().checkAction(2);
            })
        },
        funObj:function () {
            var $this = this;
            return {
                checkAction:function (pass) {
                    var desc = $('[name=desc]').val();
                    if (!desc){
                        window.top.xhTop.showError('错误', '没有审核数据');
                        return false;
                    }
                    xhExtra.ajaxRequest('hrm/mine/changeDismissStatus',{id:$this.id,pass:pass,desc:desc},{},function (res) {
                        window.top.xhTop.showSuccess(res.msg);
                        window.top.xhTop.getActiveFrame().obj.dataGrid.reload();
                        window.top.xhTop.closeModal();
                    })
                }
            }
        }
    }
};